当从另一个有不同字符集的列分配列值: UPDATE t1 SET utf8_bin_column=latin1_column; INSERT INTO t1 (latin1_column) SELECT utf8_bin_column FROM t2; 当使用字符串文字为insert或update分配值时: SET NAMES latin1; INSERT INTO t1 (utf8_bin_column) VALUES ('string-in-latin1'); 当从服务端给客户端返回结果: SET NAMES latin1; SELECT utf8_bin_column FROM t2;
mysql> SET NAMES binary; mysql> SELECT LOWER('aA'), LOWER(CONVERT('aA' USING latin1)); +-------------+-----------------------------------+ | LOWER('aA') | LOWER(CONVERT('aA' USING latin1)) | +-------------+-----------------------------------+ | aA | aa | +-------------+-----------------------------------+